// 管理用户数据相关
import { defineStore } from "pinia";
import { ref } from "vue";
import { LoginAPI } from '@/apis/user'

export const useUserStore = defineStore('user', () => {
  // 数据state
  const userInfo = ref({})
  // actions函数
  const getUserInfo = async ({account, password}) => {
    const res = await LoginAPI({ account, password })
    userInfo.value = res.result
  }
  return {
    userInfo,getUserInfo
  }
  }, {
    persist: true,
})